#!/usr/bin/env python2.5
# encoding: utf-8

if not globals().has_key("esda"):
    execfile("esda.py")
    sys.exit()

print " ** testInstructions :", "init()"
init()
print " ** testInstructions :", "newStream blah"
newStream("blah", "integer")
print " ** testInstructions :", "init()"
init()
print " ** testInstructions :", "newStream blah"
newStream("blah", "integer")
print " ** testInstructions :", "blah.set(time = 1, value = 2)"
streams["blah"][1] = 2
print " ** testInstructions :", "blah.get(time = 1)"
printValue(streams["blah"][1])
print " ** testInstructions :", "blah.set(time = 2, value = 3)"
streams["blah"][2] = 3
print " ** testInstructions :", "blah.get(time = 0:2)"
printValue(streams["blah"][0:2])
print " ** testInstructions :", "blah.set(time = 1:4, value = 4)"
streams["blah"][1:4] = 4
print " ** testInstructions :", "blah.del(ALL)"
del streams["blah"][streams["blah"].getFirstStart():streams["blah"].getLastEnd()]
print " ** testInstructions :", "blah.get(time = 0:2)"
printValue(streams["blah"][0:2])
print " ** testInstructions :", "newStream lahb"
newStream("lahb", "integer")
print " ** testInstructions :", "newStream ahbl"
newStream("ahbl", "integer")
print " ** testInstructions :", "blah.set(time = 1:3, value = 3)"
streams["blah"][1:3] = 3
print " ** testInstructions :", "blah.set(time = 3:5, value = 2)"
streams["blah"][3:5] = 2
print " ** testInstructions :", "blah.set(time = 5:9, value = 5)"
streams["blah"][5:9] = 5

print " ** testInstructions : set Lots of values for lahb and ahbl"

streams["lahb"][0] = 2
streams["lahb"][1] = 3
streams["lahb"][2] = 4
streams["lahb"][3] = -5
streams["lahb"][4] = 6
streams["lahb"][5] = 7

streams["ahbl"][0:1] = 1
streams["ahbl"][1:2] = -3
streams["ahbl"][2:3] = 4
streams["ahbl"][3:4] = 9
streams["ahbl"][4:5] = 6
streams["ahbl"][5:8] = 3

print " ** testInstructions :", "blah.get(time = 0:10)"
printValue(streams["blah"][0:10])
print " ** testInstructions :", "blah.get(time = 0:10)"
printValue(streams["blah"][0:10])

newStream("test", "string")

import random

for i in range(10):
    name = "Stream%d"%i
    
    newStream(name)
    
    # for i in range(10):
    for i in range(100):
        streams[name][50*i:50*(i+1)] = random.random()
